const Dog=require('./dog');

const dog=new Dog('汪汪',6);

dog.on('brak',(energy)=>{
    console.log("能量剩余"+energy);
})
dog.on('noEnergy',()=>{
    console.log("能量耗尽，汪汪累了");
    clearInterval(timer);
})

const timer=setInterval(()=>{
    dog.bark();
},1000);